home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / pvm34b3.zip / pvm34b3 / pvm3 / lib / aimk next >
Text File  |  1997-07-22  |  2KB  |  98 lines

  1. #!/bin/sh
  2. #
  3. #    $Id: aimk,v 1.1 1996/09/23 21:15:36 pvmsrc Exp $
  4. #
  5. #    aimk.sh
  6. #
  7. #    Make wrapper for multiple arch. builds.
  8. #
  9. #    Automatically sets PVM_ARCH for make to use.
  10. #
  11. #    Action depends on makefile locations:
  12. #    1.  If $PVM_ARCH/Makefile or $PVM_ARCH/makefile exists,
  13. #        chdir to $PVM_ARCH and exec make there.
  14. #
  15. #    2.  Else if ./Makefile.aimk exists,
  16. #        chdir to $PVM_ARCH and exec make
  17. #        with -f $PVM_ROOT/conf/$PVM_ARCH.def
  18. #        and -f $AIMK_SRC/Makefile.aimk PVM_ARCH=$PVM_ARCH
  19. #        $AIMK_SRC is the original working directory before the chdir.
  20. #
  21. #    3.  Else will simply exec make in cwd.
  22. #
  23. #    usage:
  24. #        aimk [-here] [ make args ... ]
  25. #
  26. #    09 Apr 1993  Manchek
  27. #
  28.  
  29. makeincwd=0
  30. found=1
  31. while [ $# -ge 1 -a $found = 1 ]; do
  32.     found=0
  33.     case "$1" in
  34.     -here ) makeincwd=1; shift; found=1 ;;
  35.     esac
  36. done
  37.  
  38. case "x$PVM_ROOT" in x )
  39. #    if [ -d $HOME/pvm3 ]; then
  40. #        PVM_ROOT=$HOME/pvm3
  41. #    else
  42.         echo aimk: PVM_ROOT not defined >&2
  43.         exit 1
  44. #    fi
  45. ;; esac
  46.  
  47. case "x$PVM_ARCH" in x | xUNKNOWN )
  48.     PVM_ARCH="`$PVM_ROOT/lib/pvmgetarch`"
  49.     case "x$PVM_ARCH" in x )
  50.         echo 'aimk: no pvmgetarch - is $PVM_ROOT set correctly?' >&2
  51.         exit 1
  52.     ;; esac
  53. ;; esac
  54.  
  55. export PVM_ARCH
  56. export PVM_ROOT
  57.  
  58. #
  59. # run make in cwd or subdir if exists.
  60. #
  61.  
  62. if [ $makeincwd = 0 -a \( -f $PVM_ARCH/Makefile -o -f $PVM_ARCH/makefile \) ]; then
  63.     echo making in $PVM_ARCH/ for $PVM_ARCH
  64.     cd $PVM_ARCH
  65.     if [ "$*" = "" ]; then
  66.         exec make PVM_ARCH=$PVM_ARCH
  67.     else
  68.         exec make PVM_ARCH=$PVM_ARCH "$@"
  69.     fi
  70.  
  71. else
  72.     if [ $makeincwd = 0 -a -f Makefile.aimk ]; then
  73.         if [ ! -d $PVM_ARCH ]; then
  74.             mkdir $PVM_ARCH
  75.         fi
  76.         echo making in $PVM_ARCH/ for $PVM_ARCH
  77.         AIMK_SRC=`pwd`
  78.         export AIMK_SRC
  79.         cd $PVM_ARCH
  80.         if [ "$*" = "" ]; then
  81.             exec make -f $PVM_ROOT/conf/$PVM_ARCH.def -f $AIMK_SRC/Makefile.aimk PVM_ARCH=$PVM_ARCH
  82.         else
  83.             exec make -f $PVM_ROOT/conf/$PVM_ARCH.def -f $AIMK_SRC/Makefile.aimk PVM_ARCH=$PVM_ARCH "$@"
  84.         fi
  85.  
  86.     else
  87.         echo making in . for $PVM_ARCH
  88.         if [ "$*" = "" ]; then
  89.             exec make PVM_ARCH=$PVM_ARCH
  90.         else
  91.             exec make PVM_ARCH=$PVM_ARCH "$@"
  92.         fi
  93.     fi
  94. fi
  95.  
  96. exit 1
  97.  
  98.